The PUT command is used to copy the contents of one container into another container. A container can be a field, the message box, or a temporary area you create. Basically, the Put command allows you to move information around.
Click and hold the Test Button down. Notice the Result field.
You can "put" something "into" something, "before" something, or "after" something.
into --to replace
before --to insert before
after --to append after
To see how these work, type these two lines after the first "put" command in the Script Window:
wait 1 seconds
put " There!" after field "Result"
Send To Button and Test. Then change the word "after" to "before". Send To Button and Test.
The "put" command can also be used to create a temporary holding place for information to be used in the handler. These are also called "temporary variables."If you told HyperCard to 'put "Mark" into myName', it would create a temporary variable called "myName" and put "Mark" into it. How does it know to create a temporary variable? It knows because it can't figure out what "myName" is. Creating temporary variables only works with the "put" command, but once they are created, they can be used like any other container.
Let's create a temporary variable for our greeting. First, click Reset Card to start off fresh. Then replace the first "put" command with these 2 lines:
put "Hello" into temporary
put temporary into field "Result"
Now test the button. Temporary variables come in handy when you start getting writing more complex scripts.
Click ? to find out more about "Put" and "variables".